<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>修改用户基本资料</title>
<link href="../style/common.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="../js/common.js"></script>

<script type="text/javascript">

function submit_register(){

	  var idCard = $("#idCard").val().trim();
	  var idCardReg = /^(\d{14}|\d{17})(\d|[xX])$/; 
	  if( idCard != "" && !idCardReg.test(idCard)){
		  $("#idCard").val("");
		  $("#idCard").focus();
		  alert("身份证号码填写错误。");
		  return false;
	  }

	  var mobile = $("#mobile").val().trim();
	  if(!checkMobilePhone(mobile)){
		  	$("#mobile").val("");
		    $("#mobile").focus();
			return false;
	  }

	  var emailAddress = $("#emailAddress").val().trim();
	  var emailReg = /^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/;
	  if(emailAddress != "" && !emailReg.test(emailAddress)){
		  $("#emailAddress").val("");
		  $("#emailAddress").focus();
		  alert("电子邮箱格式不正确。");
		  return false;
	  }
	    
		var province = $("#provinceInfoSelect").val();
		if( province == ""){
			 alert("请选择所在省。");
			 return false;
		}

		var city = $("#cityInfoSelect").val();
		if( city == ""){
			 alert("请选择所在市县。");
			 return false;
		}
		
		var address = $.trim($("#address").val());
		if( address  ==  ""){
			$("#address").focus();
			 alert("请填写街道地址。");
			 return false;
		}

		var zipCode = $.trim($("#zipCode").val());
		var zipCodeReg = /^[1-9][0-9]{5}$/;
		if( zipCode != "" && !zipCodeReg.test(zipCode) ){
			$("#zipCode").focus();
			 alert("邮政编码填写不正确。");
			 return false;
		}

		if(window.confirm("确认提交？")){
			 $("#registerForm").submit();
		}else{
			return false;
		}
}

$(function(){

	var city_id = '${customerInfo.cityInfo.id}';
	checkCity(city_id);
});
</script>

<style type="text/css">
#main{margin: 0 auto;width: 960px;padding-bottom: 20px;margin-top: 5px;background: #ffffff;border: 1px solid #ccc;}
#content{margin: 35px 5px 20px 68px;font-size: 14px;}
.style15 {color: #FF6600}
.input_table{padding: 3px 0px 5px 10px;}
</style>

</head>

<body>

	<%@include file="/commons/head.jsp"%>
	
	<%@include file="/user/customer_menu.jsp"%>

<div id="main">
	
	<div id="content">
		<form action="${ctx }/customer/customerAction!modifyInformation.do" method="post" id="registerForm" name="registerForm">
			<table width="100%" border="0" cellpadding="0" cellspacing="10">
				<tr><td align="right"><span class="style15">*</span>登录用户名：</td>
					<td class="input_table">${customerInfo.userName }
						<input type="radio" name="customerInfo.sex" <c:if test="${customerInfo.sex == '男' }">checked="checked"</c:if> id="sex_male" value="男"/>男士
						<input type="radio" name="customerInfo.sex" <c:if test="${customerInfo.sex == '女' }">checked="checked"</c:if> id="sex_female" value="女"/>女士
					</td>
				</tr>
				<tr><td align="right">身份证号码：</td><td class="input_table"><input name="customerInfo.idCard" value="${customerInfo.idCard }" id="idCard" maxlength="20"  size="30"/></td></tr>
				<tr><td align="right"><span class="style15">*</span>手机号码：</td><td class="input_table"><input name="customerInfo.mobile" value="${customerInfo.mobile }" id="mobile" maxlength="20" size="30"/></td></tr>
				<tr><td align="right">电话号码：</td><td class="input_table"><input name="customerInfo.telphone" value="${customerInfo.telphone }" id="telphone" maxlength="20" size="30"/></td></tr>
				<tr><td align="right">电子邮箱：</td><td class="input_table"><input name="customerInfo.email" value="${customerInfo.email }" id="emailAddress" maxlength="50" size="30"/></td></tr>
				<tr><td align="right">真实姓名：</td><td class="input_table"><input name="customerInfo.customerName" value="${customerInfo.customerName }" id="customerName" maxlength="50" size="30"/></td></tr>
				<tr><td align="right"><span class="style15">*</span>收货地址：</td>
				<td class="input_table">
					<select name="customerInfo.provinceInfo.id" id="provinceInfoSelect" onchange="changeProvince()">
                        <option value="">选择省份</option>
                        <c:forEach items="${requestScope.provinceInfoList}" var="provinceInfo" varStatus="status">
				            <option value="${ provinceInfo.id}" <c:if test="${customerInfo.provinceInfo.id == provinceInfo.id }">selected="selected"</c:if>> ${ provinceInfo.name}</option>
				        </c:forEach>
                    </select>
                    <select name="customerInfo.cityInfo.id" id="cityInfoSelect">
                        <option>选择县市</option>
                    </select>
                    <%--<select name="regionInfoSelect" id="regionInfoSelect">
	                  <option value="">区县</option>
	            	</select>
	            	 --%>
	            	&nbsp; <input name="customerInfo.address" value="${customerInfo.address }" id="address" maxlength="100" size="60"/>
				</td></tr>
				<tr><td align="right">邮政编码：</td><td class="input_table"><input name="customerInfo.zipCode" value="${customerInfo.zipCode }" id="zipCode" maxlength="20" size="30"/></td></tr>
				<tr>
					<td width="150"></td>
					<td class="input_table">
							<!-- 隐藏域 begin -->
					           <input name="customerInfo.id" value="${ sessionScope.customerInfo.id}" type="hidden" />
					        <!-- 隐藏域 end --> 
						<input type="button" onclick="javascript:submit_register()" style="cursor: pointer;padding: 5px 10px;" value="提交"/>
					</td>
				</tr>
			</table>
		</form>
	</div>
</div>

<%@ include file="/commons/foot.jsp" %>

</body>
</html>